home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / MEMORY / OLD / MEM208SRC / FSLib / h / core < prev    next >
Text File  |  1993-08-22  |  3KB  |  109 lines

  1. /* Original code (c) Acorn Computers Ltd, 1992-3 */
  2.  
  3. /* $Id: h.core 3.1 93/03/09 23:28:35 brian Exp $ */
  4. #ifndef __CORE_H
  5. #define __CORE_H
  6.  
  7. /*
  8.  * General interface routines
  9.  */
  10.  
  11. _kernel_oserror* Initialise_FileEntrys( void *private_word );
  12. void Terminate_FileEntrys( void );
  13. void ShutDown_FileEntrys( void );
  14.  
  15. /*
  16.  * These are passed to fileswitch
  17.  */
  18.  
  19. extern char FilingSystemName[];
  20. extern char ModuleName[];
  21. extern int FilingSystemInformationWord;
  22.  
  23. /*
  24.  * A type containing misc info about a file
  25.  */
  26.  
  27. typedef struct FileDesc
  28. { Information_Fields info;      /* Now Matches GBPB 10/11 format */
  29.   int length;
  30.   int attr;
  31.   int type:8;
  32.   int buffered:1;
  33.   int interactive:1;
  34.   int noosgbpb:1;
  35. } FileDesc;
  36.  
  37. /*
  38.  * opaque type used as handle
  39.  */
  40.  
  41. typedef struct FileEntry FileEntry;
  42.  
  43. /*
  44.  * Manners of opening
  45.  */
  46.  
  47. typedef enum which { CREATE, CREATEDIR, OPENIN, OPENUP, OPENDIR } WHICH;
  48.  
  49. /*
  50.  * Directory level
  51.  */
  52.  
  53. _kernel_oserror *FileEntry_Find( FileEntry *dir, char *name, FileDesc *d );
  54. _kernel_oserror *FileEntry_DirScan( FileEntry *dir, int i, FileDesc *d, char **name );
  55. _kernel_oserror *FileEntry_Delete( FileEntry *dir, char *name, FileDesc *d );
  56. _kernel_oserror *FileEntry_Rename( FileEntry *dir, char *name, FileEntry *newdir, char *newname );
  57. _kernel_oserror *FileEntry_Access( FileEntry *dir, char *name, int attr );
  58. _kernel_oserror *FileEntry_Open( FileEntry *dir, char *name, WHICH which, FileEntry **fe );
  59. _kernel_oserror *FileEntry_Close( FileEntry *fe );
  60.  
  61. /*
  62.  * Data access
  63.  */
  64.  
  65. /* input o ignored if -1 on unbuffered files (which have a seqptr) */
  66. _kernel_oserror *FileEntry_GetBytes(FileEntry *fe,char *p,int o, int n, int *newpos, int *len);
  67. _kernel_oserror *FileEntry_PutBytes(FileEntry *fe,char *p,int o, int n, int *newpos);
  68. _kernel_oserror *FileEntry_PutZeros( FileEntry *fe, int o, int n );
  69. _kernel_oserror *FileEntry_EnsureSize( FileEntry *fe, int size );
  70. _kernel_oserror *FileEntry_SetLength( FileEntry *fe, int length );
  71. _kernel_oserror *FileEntry_Flush( FileEntry *fe );
  72. _kernel_oserror *FileEntry_SetInfo( FileEntry *fe, Information_Fields info );
  73.  
  74. /*
  75.  * Following simple informative calls are assumed to always succeed -
  76.  * information should be kept inside FileEntry
  77.  */
  78.  
  79. void FileEntry_FileInfoObject( FileEntry *fse );
  80. char *FileEntry_Name( FileEntry *fe );
  81. FileDesc FileEntry_Desc( FileEntry *fe );
  82. int FileEntry_Allocated( FileEntry *fe );        /* does fileswitch really need this? */
  83. char *FileEntry_DiscName( FileEntry *fe );
  84. char *FileEntry_SpecialField( FileEntry *fe );
  85.  
  86. /*
  87.  * UnBuffered files only need provide these - others have no seqptr state
  88.  */
  89.  
  90. int FileEntry_SeqPtr( FileEntry *fe );
  91. _kernel_oserror *FileEntry_SetSeqPtr( FileEntry *fe, int seqptr );
  92. _kernel_oserror *FileEntry_PutByte( FileEntry *fe , int c );
  93. _kernel_oserror *FileEntry_GetByte( FileEntry *fe, int *c /* EOF */ );
  94.  
  95. /*
  96.  * And an entry for freespace support.
  97.  */
  98.  
  99. struct freespace { int free, biggest, size; };
  100. _kernel_oserror *FileEntry_FreeSpace( FileEntry *fe, struct freespace *f );
  101.  
  102.  
  103. #define Attr_R                          1               /* Writeable */
  104. #define Attr_W                          2               /* Readable */
  105. #define Attr_L                          8               /* Locked */
  106. #define Attr_r                          16              /* other readable */
  107. #define Attr_w                          32              /* other writeable */
  108. #endif
  109.